import type { IQuery, TableConfig } from '@/api/config/types';
import type { SystemRole } from '@/api/modules/system/role/types';

//查询参数接口
interface roleQuery {
  roleName: '';
}
let queryObj: IQuery<roleQuery> = {
  pageNum: 1,
  pageSize: 10,
  total: 0,
  roleName: '',
};
const resetQuery = () => {
  roleTable.value.query = {
    ...queryObj,
  };
};
export enum RoleViewNum {
  /* 首页表单 */
  'ROLE_TABLE' = 'ROLE_TABLE',
  /* 编辑基本信息 */
  'ROLE_FORM' = 'ROLE_FORM',
  /* 分配身份 */
  'IDENTITY' = 'IDENTITY',
  /* 分配资源 */
  'RESOURCE' = 'RESOURCE',
  /* 分配角色 */
  'ASSIGN' = 'ASSIGN',
  /* 取消分配角色 */
  'UNASSIGN' = 'UNASSIGN',
}
export const roleTable = ref<TableConfig<SystemRole>>({
  //作用：勾选的唯一标识
  rowKey: 'roleId',
  data: [],
  loading: false,
  moduleName: 'role',
  keys: [],
  query: queryObj,
  contextmenu: [],
  reset: resetQuery,
});
export const roleMenus = ref();
export const deptList = ref();

export const roleFormMode = ref<RoleViewNum>(RoleViewNum.ROLE_TABLE);
